import React from 'react'
// ===================================================================== Temp
import FormModal from '#cpt/temp/FormModal'
// ===================================================================== global declare
const { $fn, $Lazy } = window
// ===================================================================== Lazy
const message = $Lazy.file(()=>import('@antd/message'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		// 提交表单列表
		formData : [
			{ label: '设备编号',		name: 'device_number', full:true, required:true, onValue:({ value }) => {
				$fn.local(this.saveName, value)
			} },
		]
	}
	
	componentDidMount(){
		// const { result_model, project_id } = this.props.query || {}
		this.saveName = 'xiafa'
	}
	open = () => {
		this.modal.open({ formRef: this.formRef })
		const device_number = $fn.local(this.saveName)
		this.formRef.setValue({ device_number: device_number ? device_number : '' })
	}
	
	render(){
		// const { info } = this.props
		// return FormModal.call(this,{ title:'下发设置', labelWidth:'s5', width:600, api: 'ts-report-card/bingliImgconf', okText:'下发', 
		// 	getSubmit: () => {
		// 		const { experiment_num } = info || {}
		// 		return { experiment_num, type:1 }
		// 	},
		// 	onRefresh: ({ param })=>{
		// 		$http.submit(null, 'ts-report-card/checkBingliImgsUpdateCount', { param })
		// 	},
		// })
		return FormModal.call(this,{ title:'下发设置', labelWidth:'s5', width:600, onSubmit:({device_number}, close)=>{
			$fn.local(this.saveName, device_number)
			message.then(f=>f.success('下发设置成功'))
			close()
		}})
	}
}

export default Index